package com.bw.mallshop.timmer;

import android.os.Message;

public class TimeServiceThread extends Thread{

    private TimmerHandler handler;

    public TimeServiceThread(TimmerHandler handler){
        this.handler = handler;
    }

    @Override
    public void run() {
        super.run();
//        interrupt();->向线程发送一个终端信号量->传递一个终端标志
        while (!isInterrupted()){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            Message msg = handler.obtainMessage();
            msg.obj = 1;
            handler.sendMessage(msg);
        }
    }
}
